// import React  from 'react'
import { View,Image  } from '@tarojs/components'
import './index.scss'
import Taro from "@tarojs/taro";
import {useEffect, useState} from "react";


function Index() {
  //获取登录凭证
  // let token =Taro.getStorageSync('userId')
  const [token,setToken] =useState('')

  console.log(token)
  useEffect(()=>{

    console.log('sssssssssssssssssssssssss')
    // token='sss'
  })

  //点击编辑资料
  const infoEdit =()=>{
    Taro.navigateTo({
      url:'/pages/infoEdit/index'
    })
  }
  //去登陆/注册页面
  const loginBtn =()=>{
    Taro.navigateTo({url:'/pages/login/index'})
  }

  //点击收款账号
  const collectionAccount =()=>{
    Taro.navigateTo({
      url:'/pages/collectionAccount/index'
    })
  }

  //点击我的订单
  const myOrder =()=>{
    Taro.navigateTo({
      url:'/pages/order/index'
    })
  }


  //点击服务项目
  const serviceItems =()=>{
    Taro.navigateTo({
      url:'/pages/serviceItems/index'
    })
  }

  //点击服务项目
  const  serviceRange=()=>{
    Taro.navigateTo({
      url:'/pages/serviceRange/index'
    })
  }

  //点击收到的评价
  const  evaluate=()=>{
    Taro.navigateTo({
      url:'/pages/evaluate/index'
    })
  }


  //点击设置
  const  setting=()=>{
    Taro.navigateTo({
      url:'/pages/setting/index'
    })
  }
  return (
    <View className='me'>
      <View style={{backgroundColor:'#fff',height:'80px',lineHeight:'80px'}}>
        <View style={{position:'fixed',top:'0',left:'0',fontSize:'22px',paddingLeft:'20px'}} onClick={()=>Taro.navigateBack}></View>
        <View style={{textAlign:'center',width:'100%'}}></View>
      </View>
      {/*已经登录*/}
      <View className='login' style={{display:token?'block':'none'}}>
        {/*头像*/}
        <View className='header'>
          <View className='avator'>
            <Image src='https://img2.baidu.com/it/u=3035872156,255770104&fm=253&app=138&size=w931&n=0&f=PNG&fmt=auto?sec=1658595600&t=1efdb503efe49c5b749b695bb857ca75'></Image>
          </View>
          <View className='header_right'>
            <View className='right_fir iconfont icon-xiugai' onClick={infoEdit}></View>
            <View className='right_sec'>王小谧</View>
            <View className='right_thr'>从业8年，用心为您服务，您的满意就是我最大的追求</View>
          </View>
        </View>
        {/*实名认证*/}
        <View className='list'>
          <View className='list_item'>
            <View className='iconfont icon-shimingrenzheng'></View>
            <View  className='title'>实名认证</View>
            <View className='iconfont icon-xiangyou1'></View>
          </View>
          <View className='list_item list_item_no' onClick={collectionAccount}>
            <View className='iconfont icon-shoukuan'></View>
            <View  className='title'>收款账号</View>

            <View className='iconfont icon-xiangyou1'></View>
          </View>
        </View>
        {/*订单服务*/}
        <View className='list'>
          <View className='list_item' onClick={myOrder}>
            <View className='iconfont icon-wodedingdan'></View>
            <View  className='title'>我的订单</View>

            <View className='iconfont icon-xiangyou1'></View>
          </View>
          <View className='list_item' onClick={serviceItems}>
            <View className='iconfont icon-fuwuxiangmu'></View>
            <View  className='title'>服务项目</View>

            <View className='iconfont icon-xiangyou1'></View>
          </View>
          <View className='list_item list_item_no' onClick={serviceRange}>
            <View className='iconfont icon-service_range'></View>
            <View  className='title'>服务范围</View>

            <View className='iconfont icon-xiangyou1'></View>
          </View>
        </View>
        {/*评价*/}
        <View className='list'>
          <View className='list_item list_item_no' onClick={evaluate}>
            <View className='iconfont icon-pingjia'></View>
            <View  className='title'>收到的评价</View>

            <View className='iconfont icon-xiangyou1'></View>
          </View>
        </View>
        {/*设置*/}
        <View className='list'>
          <View className='list_item list_item_no' onClick={setting}>
            <View className='iconfont icon-shezhi'></View>
            <View  className='title'>设置</View>

            <View className='iconfont icon-xiangyou1'></View>
          </View>
        </View>
      </View>
      {/*没有登录*/}
      <View  className='noLogin' style={{display:token == ''?'block':'none'}}>
        <View className='login_box'>
          <View className='login_btn' onClick={loginBtn}>登录/注册</View>
        </View>
        <View className='list '>
          <View className='list_item'>
            <View className='iconfont icon-shezhi'></View>
            <View  className='title'>设置</View>

            <View className='iconfont icon-xiangyou1'></View>
          </View>
        </View>
      </View>
    </View>
  );
}

export default Index;
